﻿///////////////////////////////////////////////////////////////////////////
//  Copyright(c) 2023, GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007
//
/// @file    sprite.cpp
/// @brief   精灵
/// @version 0.1
/// @history 修改历史
/// @warning 没有警告
///////////////////////////////////////////////////////////////////////////
#include "element/elements.h"
#include "klbmem/klb_mem.h"


typedef struct sprite_t_
{
    int a;
}sprite_t;

//////////////////////////////////////////////////////////////////////////



//////////////////////////////////////////////////////////////////////////

/// @brief 销毁
static void sprite_destroy(geobj_t* p_obj)
{
    sprite_t* p_sprite = (sprite_t*)p_obj->extra;

    KLB_FREE(p_obj);
}

static int on_draw_sprite(geobj_t* p_obj, render_t* p_render)
{
    if (NULL != p_render->draw_image)
    {
        p_render->draw_image("bbb", NULL, NULL);
    }

    return 0;
}

/// @brief 向object设置数据
static int on_sprite_set(geobj_t* p_obj, const klb_map_t* p_map)
{
    sprite_t* p_sprite = (sprite_t*)p_obj->extra;

    return 0;
}

/// @brief 向object获取数据
static klb_map_t* on_sprite_get(geobj_t* p_obj, const klb_map_t* p_map)
{
    sprite_t* p_sprite = (sprite_t*)p_obj->extra;

    return NULL;
}

//////////////////////////////////////////////////////////////////////////

geobj_t* sprite_create()
{
    geobj_t* p_obj = KLB_MALLOCZ(geobj_t, 1, sizeof(sprite_t));
    sprite_t* p_sprite = (sprite_t*)p_obj->extra;

    p_obj->vtable.cb_destroy = sprite_destroy;
    p_obj->vtable.cb_set = on_sprite_set;
    p_obj->vtable.cb_get = on_sprite_get;
    p_obj->vtable.cb_draw = on_draw_sprite;

    return p_obj;
}
